import { useCallback, useState } from "react";
import A from './A'
function App() {
  const [name, setName] = useState('App')
  console.log('App渲染');
  //使用useCallback
  const changName = useCallback(() => {
    setName(pre => pre + 's')
  })

  //不使用useCallback
  // const changName = () => {
  //   setName(pre => pre + 's')
  // }
  return (
    <div className="App" style={{ width: '400px', height: '400px', backgroundColor: 'pink' }}>
      我是app,我是粉色Name:{name}
      <A changAppName={changName} />
    </div>
  );
}

export default App;
